package pe.edu.upc.dsd.whereeat.domain;

import java.io.Serializable;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import pe.edu.upc.dsd.whereeat.base.domain.BaseEntity;

import java.util.List;


/**
 * The persistent class for the categoria database table.
 * 
 */
@Entity
@Table(name="categoria")
@XmlRootElement
public class Categoria extends BaseEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(unique=true, nullable=false)
	private int codigo;

	@Column
	private String estado;

	@Column
	private String nombre;

	//bi-directional many-to-one association to Restaurant
	@OneToMany(mappedBy="categoria",fetch=FetchType.EAGER)
	@Fetch(value = FetchMode.SUBSELECT)
	private List<Restaurant> restaurants;

    public Categoria() {
    }

	public int getCodigo() {
		return this.codigo;
	}

	public void setCodigo(int codigo) {
		this.codigo = codigo;
	}

	public String getEstado() {
		return this.estado;
	}

	public void setEstado(String estado) {
		this.estado = estado;
	}

	public String getNombre() {
		return this.nombre;
	}

	public void setNombre(String nombre) {
		this.nombre = nombre;
	}

	public List<Restaurant> getRestaurants() {
		return null;//this.restaurants;
	}

	public void setRestaurants(List<Restaurant> restaurants) {
		this.restaurants = restaurants;
	}
	
}